# Description: Acik kaynak kodlu OpenGL uyumlu grafik kutuphanesi
# URL: http://www.xorg-mesa3d.org
# Packagers: milisarge
# Depends on: pkg-config libtool wayland xorg-libx11 xorg-libdrm xorg-libxext xorg-libxdamage expat llvm elfutils xorg-libxshmfence 

name=xorg-mesa
version=12.0.3
release=1
source=(ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-$version.tar.xz
	    http://www.linuxfromscratch.org/patches/downloads/mesa/mesa-$version-add_xdemos-1.patch
	    https://github.com/imirkin/mesa/commit/2e6b0e24cfb0f467e8b6d6f394730442a72dcdaf.diff
	    https://github.com/imirkin/mesa/commit/2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff
	    https://github.com/imirkin/mesa/commit/940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff)
build() {
cd mesa-$version
patch -Np1 -i ../mesa-$version-add_xdemos-1.patch
patch -p1 -i ../2e6b0e24cfb0f467e8b6d6f394730442a72dcdaf.diff
patch -p1 -i ../2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff
patch -p1 -i ../940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff
sed -e "/PTHREADSTUBS/d" -i configure.ac
./autogen.sh CFLAGS='-O2' CXXFLAGS='-O2'    \
--prefix=/usr                  \
--sysconfdir=/etc              \
--enable-texture-float         \
--enable-gles1                 \
--enable-gles2                 \
--enable-osmesa                \
--enable-xa                    \
--enable-gbm                   \
--enable-glx-tls               \
--with-egl-platforms="drm,x11,wayland" \
--with-gallium-drivers="nouveau,r300,r600,radeonsi,svga,swrast"
make
make -C xdemos DEMOS_PREFIX=/usr
make DESTDIR=$PKG install
make -C xdemos DEMOS_PREFIX=/usr DESTDIR=$PKG install
install -v -dm755 $PKG/usr/share/doc/mesa-$version

}
